package xyz.labmem.main.modular.app.rmwz.mapper

import org.apache.ibatis.annotations.Select
import org.springframework.stereotype.Repository
import xyz.labmem.base.core.entity.ModuleVo
import xyz.labmem.main.modular.app.rmwz.entity.App_tyjrcjb

import xyz.labmem.main.modular.common.mapper.AppBaseMapper
import java.util.Objects

/**
 * @Author lty
 * @Date 2022/2/10 16:52
 */
@Repository
interface App_tyjrcjb_Mapper : AppBaseMapper<App_tyjrcjb>{
    @Select("select \${cloum} as name,count(1) as value from tyjrcjb group by \${cloum}  order by \${cloum} ")
    fun selectCountByTable(clomn : String) : ArrayList<ModuleVo>

    @Select("select nld AS 'value',count(1) AS 'name'\n" +
            "from (\n" +
            "\tselect  \n" +
            "\t\t\t\tCASE\n" +
            "        WHEN age >= 20 AND age <= 25 THEN '20-25岁'\n" +
            "        WHEN age >= 26 AND age <= 30 THEN '26-30岁'\n" +
            "\t\t\t\tWHEN age >= 31 AND age <= 35 THEN '31-35岁'\n" +
            "\t\t\t\tWHEN age >= 36 AND age <= 45 THEN '36-45岁'\n" +
            "        END AS nld\n" +
            "from (\n" +
            "\tselect \n" +
            "\t\t(substring(now(),1,4)-substring(JBXX_SFZHM,7,4))-(substring(JBXX_SFZHM,11,4)-date_format(now(),'%m%d')>0) as age\n" +
            "\tfrom tyjrcjb where 1=1 \${cloum} \n" +
            ") a \n" +
            ") b\n" +
            "GROUP BY nld order by nld ")
    fun selectChart(clomn : String?) : ArrayList<Map<Objects,Objects>>
}
